#include "camprec.h"
#include "OGLAdapter.h"


//DWORD COGLAdapter::m_ID = 0;


COGLAdapter::COGLAdapter(void)
{
	//m_ID++;
	//StrID (mystr::format(_T("OGLAdapter%d"),m_ID));
}

COGLAdapter::~COGLAdapter(void)
{

}

void COGLAdapter::clear ()
{
	m_pCompiledLists.reset(0);
	m_pDrawElementsByIndex.reset(0);
	m_pDrawArrays.reset(0);
	m_pDrawText.reset(0);
}

CCompiledLists  * COGLAdapter::InitCompiledLists ()
{
	if (!CompiledList())
	{
		m_pCompiledLists.reset (new CCompiledLists ());
		//RegisterChildObj (CompiledList()->StrID(),CompiledList ());
	}
	//else
	//	CompiledList()->Free ();
	return CompiledList();
	
}

//void COGLAdapter::FreeCompiledLists ()
//{
//	m_pCompiledLists.reset ()
//}

CDrawElementsByIndex  * COGLAdapter::InitDrawElementsByIndex ()
{
	m_pDrawElementsByIndex.reset(new CDrawElementsByIndex ());
	//RegisterChildObj (DrawElementsByIndex()->StrID(),DrawElementsByIndex ());

	return m_pDrawElementsByIndex.get();
}

//void COGLAdapter::FreeDrawElementsByIndex ()
//{
//	delete m_pDrawElementsByIndex;
//	m_pDrawElementsByIndex = NULL;
//}


CDrawArrays  *COGLAdapter::InitDrawArrays ()
{
	m_pDrawArrays.reset( new CDrawArrays ());

	//RegisterChildObj (DrawArrays()->StrID(),DrawArrays ());

	return m_pDrawArrays.get ();
}

//void COGLAdapter::FreeDrawArrays ()
//{
//	delete m_pDrawArrays;
//	m_pDrawArrays = NULL;
//}

CDrawText *COGLAdapter::InitDrawText()
{
	m_pDrawText.reset( new CDrawText ());

	//RegisterChildObj (DrawText()->StrID(),DrawText ());

	return m_pDrawText.get ();
}
